import java.util.ArrayList;

public abstract class Mediator {
    protected ArrayList<Component> componentsList = new ArrayList<>();

    public void addComponents(Component c) {
        componentsList.add(c);
        c.setMediator(this); // 设置中介者
    }

    public abstract void componentChanged(Component c);
}